package com.xu.crawler.dao.impl;

import com.xu.crawler.dao.FailRecordDao;
import com.xu.crawler.dao.entity.FailRecordDO;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by clear on 2018/7/17.
 */
@Repository
public class FailRecordDaoImpl implements FailRecordDao {

    @Resource
    private MongoTemplate mongoTemplate;

    @Override
    public void saveFailRecord(FailRecordDO failRecordDO) {
        mongoTemplate.save(failRecordDO);
    }

    @Override
    public List<FailRecordDO> queryFails() {
        return mongoTemplate.find(new Query(),FailRecordDO.class);
    }
}
